import request from '@/config/axios'

// facebook广告账户每日消耗 VO
export interface EverdayCostVO {
  costId: number // 广告账号每日消耗记录id
  advertiserId: number // 广告账号id
  advertiserName: string // 广告账号名称
  productId: string // 商品id
  thatdayTimestamp: number // 当日时间戳
  thatdayDate: string // 当日日期
  thatdayTotalAmount: number // 当日总收入
  thatdayPaidTotalNum: number // 当日总支付笔数
  area: string // 地区
  spend: number // 广告花费金额（美元）
  spendForeign: number // 广告花费金额（外币）
  impressions: number // 展示数
  cpm: number // 千次展示成本=总消耗/展示数*1000
  clicks: number // 点击数
  ctr: number // 点击率
  cpc: number // 单次点击成本=总花费/点击数
  inlineLinkClicks: number // 链接点击数
  costPerInlineLinkClick: number // 链接点击的平均成本=花费/链接点击次数
  cpp: number // 预估1000人平均成本
  reach: number // 覆盖人数
  frequency: number // 频次
  deptId: number // 部门id
  createName: string // 创建者名称
}

// facebook广告账户每日消耗 API
export const EverdayCostApi = {
  // 查询facebook广告账户每日消耗分页
  getEverdayCostPage: async (params: any) => {
    return await request.get({ url: `/facebook/everday-cost/page`, params })
  },

  // 查询facebook广告账户每日消耗详情
  getEverdayCost: async (id: number) => {
    return await request.get({ url: `/facebook/everday-cost/get?id=` + id })
  },

  // 新增facebook广告账户每日消耗
  createEverdayCost: async (data: EverdayCostVO) => {
    return await request.post({ url: `/facebook/everday-cost/create`, data })
  },

  // 修改facebook广告账户每日消耗
  updateEverdayCost: async (data: EverdayCostVO) => {
    return await request.put({ url: `/facebook/everday-cost/update`, data })
  },

  // 删除facebook广告账户每日消耗
  deleteEverdayCost: async (id: number) => {
    return await request.delete({ url: `/facebook/everday-cost/delete?id=` + id })
  },

  // 导出facebook广告账户每日消耗 Excel
  exportEverdayCost: async (params) => {
    return await request.download({ url: `/facebook/everday-cost/export-excel`, params })
  },
}
